Fix bug with kml geometryElements pointed out by Valerio Messina. Don't repeat extru...
authortsteven4 <tsteven4@gmail.com>
Sun, 18 Dec 2016 23:54:32 +0000 (16:54 -0700)
committertsteven4 <tsteven4@gmail.com>
Sun, 18 Dec 2016 23:54:32 +0000 (16:54 -0700)
kml.cc

diff --git a/kml.cc b/kml.cc
index 92884861849fe02f578ebc40fdb6fd8b18e77ab3..519488d4503d13c371a1b6147b5647224c178c11 100644 (file)
--- a/kml.cc
+++ b/kml.cc
@@ -868,15 +868,21 @@ static void kml_output_lookat(const Waypoint* waypointp)
   writer->writeEndElement(); // Close LookAt tag
 }
 
-static void kml_output_positioning(void)
+static void kml_output_positioning(bool tessellate)
 {
+  // These elements must be output as a sequence, i.e. in order.
+  if (extrude) {
+    writer->writeTextElement("extrude", "1");
+  }
+
+  if (tessellate) {
+    writer->writeTextElement("tessellate", "1");
+  }
+
   if (floating) {
     writer->writeTextElement("altitudeMode", "absolute");
   }
 
-  if (extrude) {
-    writer->writeTextElement("extrude", "1");
-  }
 }
 
 /* Output something interesing when we can for route and trackpoints */
@@ -1022,11 +1028,7 @@ static void kml_output_point(const Waypoint* waypointp, kml_point_type pt_type)
     }
 
     writer->writeStartElement("Point");
-    kml_output_positioning();
-
-    if (extrude) {
-      writer->writeTextElement("extrude", "1");
-    }
+    kml_output_positioning(false);
     kml_write_coordinates(waypointp);
     writer->writeEndElement(); // Close Point tag
 
@@ -1092,8 +1094,7 @@ static void kml_output_tailer(const route_head* header)
           writer->writeEndElement(); // Close LineString tag
         }
         writer->writeStartElement("LineString");
-        kml_output_positioning();
-        writer->writeTextElement("tessellate","1");
+        kml_output_positioning(true);
         writer->writeStartElement("coordinates");
         writer->writeCharacters("\n");
       }
@@ -1625,7 +1626,7 @@ static void kml_waypt_pr(const Waypoint* waypointp)
 
   // Location
   writer->writeStartElement("Point");
-  kml_output_positioning();
+  kml_output_positioning(false);
   kml_write_coordinates(waypointp);
   writer->writeEndElement(); // Close Point tag
 
@@ -1760,7 +1761,7 @@ static void kml_mt_hdr(const route_head* header)
   writer->writeOptionalTextElement("name", header->rte_name);
   writer->writeTextElement("styleUrl", "#multiTrack");
   writer->writeStartElement("gx:Track");
-  kml_output_positioning();
+  kml_output_positioning(false);
 
   QUEUE_FOR_EACH(&header->waypoint_list, elem, tmp) {
     Waypoint* tpt = (Waypoint*)elem;